{extend name="public/base" /}
{block name="style"}
<link rel="stylesheet" href="__PUBLIC__/admin/material/css/index.css?v=20221110&times=111" />
<link rel="stylesheet" href="__PUBLIC__/admin/material/css/iconfont.css" />
<link rel="stylesheet"
	href="https://at.alicdn.com/t/c/font_3754223_ggmk0srtt6.css?spm=a313x.7781069.1998910419.54&file=font_3754223_ggmk0srtt6.css">
{include file="material/_ali_icon" /}
<link rel="stylesheet" type="text/css" href="__PUBLIC__/plugs/webuploader/webuploader.css">
<style>
	.main-box-body .navs .active {
		background: azure;
		color: #03a9f4;
		border: 1px solid #03a9f4;
		border-radius: 5px;
	}

	a {
		color: #777;
		text-decoration: none;
	}

	a:hover {
		text-decoration: none
	}

	.table tbody>tr>td {
		padding: 0px 8px;
	}

	.table-hover>tbody>tr:nth-child(odd) {
		background-color: #f9f9f9;
	}

	.table-responsive {
		min-height: 470px;
	}

	.table thead>tr>th,
	.table tbody>tr>td:first-child,
	.table tbody>tr>td {
		padding: 8px 0;
	}

	#sidebar-nav .nav>.open .submenu>li>.submenu a:before,
	#sidebar-nav .nav>.active .submenu>li>.submenu a:before {
		content: "";
	}

	.uploadify-button-text {
		position: relative;
		display: inline-block;
		cursor: pointer;
		background: #fff;
		padding: 0px 5px;
		color: #333;
		text-align: center;
		border-radius: 3px;
		overflow: hidden;
		border: 1px solid #ccc;
	}

	em {
		color: red;
	}

	.big .panel-body {
		background-color: #fffcfc;
		padding: 10px 30px;
	}

	.big-panel-head {
		background-color: #ededed;
		padding: 3px 10px;
	}

	.btnGurp {
		font-size: 14px;
		display: flex;
		align-items: center;
	}

	.btnGurp>div {
		margin-right: 5px;
	}

	.btnGurp>div:last-child {
		margin-right: 0;
	}

	.tiktok .panel-body>span {
		height: 178px;
	}

	.tiktok .panel-body>span::-webkit-scrollbar,
	.big .headContent::-webkit-scrollbar {
		width: 5px;
	}

	/* 滚动槽 */
	.tiktok .panel-body>span::-webkit-scrollbar-track,
	.big .headContent::-webkit-scrollbar-track {
		-webkit-box-shadow: inset006pxrgba(0, 0, 0, 0.8);
		border-radius: 10px;
	}

	/* 滚动条滑块 */
	.tiktok .panel-body>span::-webkit-scrollbar-thumb,
	.big .headContent::-webkit-scrollbar-thumb {
		border-radius: 10px;
		background: rgba(0, 0, 0, 0.1);
		-webkit-box-shadow: inset006pxrgba(0, 0, 0, 0.5);
	}

	.big .headContent {
		height: 635px !important;
	}
</style>
{/block}
{block name="body"}
<div class="main-box clearfix">
	<header class="main-box-header clearfix">
		<div class="pull-right">
			{if checkAuthRule('del')}<button type="button" class="btn btn-warning"> <input class="checkbox check-all"
					type="checkbox" style="display: inline-block;margin-top: -2px;vertical-align: middle;"> 全选
			</button>{/if}
			<button type="button" class="btn btn-success " id="lower">
				下放
			</button>
			<!-- <button type="button" class="btn btn-primary" id="createUrl">
				<i class="fa fa-plus"></i> 添加素材 <span class="caret"></span>
			</button> -->
			{if checkAuthRule('down_all')}<button type="button" class="btn btn-info"
				onclick="down_all('{:url('down_all',['source' => 'mycenter'])}')">
				<i class="fa fa-cloud-download"></i> 全库TXT
			</button>{/if}
			<!-- <button class="btn btn-primary ajax-get confirm" url="{:url('down_douyin_txt')}?platform_ids={$platform_id}&type={$type}" target-form="ids">下载TXT</button> -->
			{if checkAuthRule('del')}<button class="btn btn-danger ajax-post confirm" url="{:url('del_my')}"
				target-form="ids">删 除</button>{/if}
		</div>
		<div class="row">
			<form method="get">

				{include file="material/_search2" /}
			</form>
		</div>
	</header>
	<div class="main-box-body clearfix">
		<!-- 搜索相关 -->
		{include file="material/_search" /}
		<div id="" class="clear"></div>
		{empty name="list"}
		{/empty}

		{if $mb == 1}

		<div class="tiktok">
			<div class="row toolTip">
				{volist name="list" id="vo"}
				<div id="content_{$vo.id}" style="display: none;">
					{:str_replace("####","<br />",htmlspecialchars_decode($vo['content_zh2']))}</div>
				<div class="col-md-3">
					<div class="panel panel-default">
						{php}
						$bgcolor = "#fbfafa";
						$color = "";
						if($vo["channel_zh"] == "男"){
						$bgcolor = "#dceaf7";
						$color = '#658399';
						}
						if($vo["channel_zh"] == "女"){
						$bgcolor = "#fff5ff";
						$color = '#ad8d93';
						}
						{/php}
						<div class="panel-body" style="background: {$bgcolor};padding:10px 40px;">
							<span style="color:{$color};">{:str_replace("####","<br />",htmlspecialchars_decode($vo['content_zh2']))}</span>
							<div class="show">展开</div>
							<!-- <div class="rate">{$vo.score}</div> -->
							<div class="setting">
								<div onclick="change_status({$vo.id})">
									{if $vo['status'] == 0}
									<span style="font-size: 19px;" class="iconfont icon-duigou"></span>
									{else/}
									<span style="font-size: 19px;" class="iconfont icon-duigou-copy"></span>
									{/if}
								</div>

								<div style="margin-top:10px;" onclick="upload(this, {$vo['id']})"
									id="upload_id_{$vo['id']}" data-json='{:json_encode($vo)}'>
									{if $vo['is_upload']}<i class="iconfont icon-shangchuan1-copy"></i>{else/}<i
										class="iconfont icon-shangchuan1"></i>{/if}
								</div>

							</div>
						</div>
						<div class="panel-footer" style="flex-direction: column;">
							<div style="width: 100%;justify-content: space-between;color: #b1b0b0;">
								<!-- <span>{$vo['title']|default="无"}</span> -->
								<div style="display: flex;align-items: center;">
									<input class="ids row-selected" type="checkbox" name="id[]" value="{$vo['id']}"
										style="margin: 0;margin-right:4px">
									<span
										style="white-space: nowrap;text-overflow: ellipsis;overflow: hidden;word-break: break-all;width: 150px;">{$vo.title}</span>
								</div>
								<span>{$vo['show_time']}</span>
							</div>
							<div style="justify-content: space-between;width: 100%;">
								<div style="display: flex;align-items: center;">

									<div style="display: flex;align-items: center;">
										<!-- <span class="title">{$vo.book_id_zh}</span> -->
										<!-- <span class="title">我是数目</span> -->
										<span style="margin-right:5px">{$vo.num}</span>
										<span class="name">
											{if $vo['is_distribution'] == 1}
											<span style="color: #e84e40;">{$userlist[$vo['uid']]??$vo['uid']}</span>
											{else/}
											{$userlist[$vo['uid']]??$vo['uid']}
											{/if}
										</span>
										<!-- {$vo.category_id_zh} -->
										<!-- <div class="tiktokLabel">
											{$vo.tag_ids_zh}
										</div> -->
									</div>
								</div>

								<div style="font-size: 14px;font-weight: bold;display: flex;">
									<div onclick="copyContent(`{:str_replace('####','<br/>',htmlspecialchars_decode($vo['content_zh2']))}`, {$vo.id})" class="douyin_copy "
									style="color:#000;margin-right:6px">
									复制(<span class="copyNum emCopy{$vo.id}">{$vo['copy_click_num']??0}</span>)
								</div>


								<div style="cursor: pointer;margin-right:6px">
									<a style="color:#000"
										onclick="downTxt('{:url('down_txt')}?platform_ids={$platform_id}&type={$type}&id[]={$vo.id}')">TXT</a>
								</div>

								<div style="cursor: pointer;margin-right:6px">
									<a style="color:#000" onclick="editreferral(this)"
										data-json='{:json_encode($vo)}'>编辑</a>
								</div>

							</div>
						</div>
					</div>
				</div>
				<div class="mask">
					<i class="iconfont icon-cuowu"></i>
					<!-- <span aria-hidden="true">×</span> -->
					<div class="content" style="min-height: 250px;background: {$bgcolor};color:{$color};">
						{:str_replace("####","<br />",htmlspecialchars_decode($vo['content_zh2']))}
					</div>
				</div>
			</div>
			{/volist}
		</div>
	</div>
	{/if}

	{if $mb == 2}
	<div class="tiktok small">
		<div class="row">
			<div class="col-md-6">
				<table class="table table-hover table-bordered">
					<thead>
						<tr>
							<th width="50px"><input class="checkbox check-all" type="checkbox" style="display:inline">
							</th>
							<th width="50px">序号</th>
							{include file="material/_book_sort" /}
							<th width="340px">文件名</th>
							<th width="80px">工号</th>

							{include file="material/_status_sort" /}
							<th width="80px">复制文案</th>
							<!-- <th>热度/平台/频道/分类/工号</th> -->
							<!-- <th width="10%">标签</th> -->
							{if checkAuthRule('edit')}
							<th width="130px">操作</th>
							{/if}
						</tr>
					</thead>
					<tbody>
						{empty name="list"}
						<tr>
							<td colspan="9" align="center">暂无数据</td>
						</tr>
						{/empty}
						{volist name="list" id="vo" mod="2"}
						{eq name="mod" value="0"}
						<div id="content_{$vo.id}" style="display: none;">
							{:str_replace("####","<br />",htmlspecialchars_decode($vo['content_zh2']))}</div>
						<tr>
							<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$vo['id']}"></td>
							<td>{$vo.num}</td>
							<td class="title">{$vo.book_id_zh}</td>
							<td style="text-align: left;font-size: 16px;">{$vo['title']|default="无"}</td>
							<td>
								{if $vo['is_distribution'] == 1}
								<span style="color: #e84e40;">{$userlist[$vo['uid']]??$vo['uid']}</span>
								{else/}
								{$userlist[$vo['uid']]??$vo['uid']}
								{/if}
							</td>
							<td class="status" onclick="change_status({$vo.id})">
								{if $vo['status'] == 0}
								<span class="iconfont icon-tongguo"></span>
								过稿
								{else/}
								<span style="color: #eb3939;">
									<span class="iconfont icon-tongguo"></span>
									已过稿</span>
								{/if}
							</td>
							<td>
								<div onclick="copyContent(`{:str_replace('####','<br/>',htmlspecialchars_decode($vo['content_zh2']))}`, {$vo['id']},false)" class="copy">
								<span class="iconfont icon-copy"></span>
								复制
			</div>
			</td>
			<!-- <td>{$vo.hot_zh} / {$vo.platform_ids_zh} / {$vo.channel_zh} / {$vo.category_id_zh} | 
										{if $vo['is_distribution'] == 1}
								<span style="color: #e84e40;">{$userlist[$vo['uid']]??$vo['uid']}</span>
								{else/}
								{$userlist[$vo['uid']]??$vo['uid']}
								{/if} </td> -->
			<!-- <td>{$vo.tag_ids_zh}</td> -->
			{if checkAuthRule('edit')}
			<td>
				{if checkAuthRule('del')}<a href="{:url('del_my',array('id'=>$vo['id']))}" class="ajax-get confirm"><i
						class="fa fa-times"></i> 删除</a>{/if}
				<a href="JavaScript:;" onclick="editreferral(this)" data-json='{:json_encode($vo)}'><i
						class="fa fa-edit"></i> 查看</a>
			</td>
			{/if}
			</tr>
			{/eq}
			{/volist}
			</tbody>
			</table>
		</div>
		<div class="col-md-6">
			<table class="table table-hover table-bordered">
				<thead>
					<tr>
						<th width="50px"><input class="checkbox check-all" type="checkbox" style="display:inline"></th>
						<th width="50px">序号</th>
						{include file="material/_book_sort" /}
						<th width="340px">文件名</th>
						<th width="80px">工号</th>

						{include file="material/_status_sort" /}
						<th width="80px">复制文案</th>
						<!-- <th>热度/平台/频道/分类/工号</th> -->
						<!-- <th width="10%">标签</th> -->
						{if checkAuthRule('edit')}
						<th width="130px">操作</th>
						{/if}
					</tr>
				</thead>
				<tbody>
					{empty name="list" }
					<tr>
						<td colspan="9" align="center">暂无数据</td>
					</tr>
					{/empty}
					{volist name="list" id="vo" mod="2"}
					{eq name="mod" value="1"}
					<tr>
						<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$vo['id']}"></td>
						<td>{$vo.num}</td>
						<td class="title">{$vo.book_id_zh}</td>
						<td style="text-align: left;font-size: 16px;">{$vo['title']|default="无"}</td>
						<td>
							{if $vo['is_distribution'] == 1}
							<span style="color: #e84e40;">{$userlist[$vo['uid']]??$vo['uid']}</span>
							{else/}
							{$userlist[$vo['uid']]??$vo['uid']}
							{/if}
						</td>
						<td class="status" onclick="change_status({$vo.id})">
							{if $vo['status'] == 0}
							<span class="iconfont icon-tongguo"></span>
							过稿
							{else/}
							<span style="color: #eb3939;">
								<span class="iconfont icon-tongguo"></span>
								已过稿</span>
							{/if}
						</td>
						<td>
							<div onclick="copyContent(`{:str_replace('####','<br/>',htmlspecialchars_decode($vo['content_zh2']))}`, {$vo['id']},false)" class="copy">
							<span class="iconfont icon-copy"></span>
							复制
		</div>
		</td>

		<!-- <td>{$vo.hot_zh} / {$vo.platform_ids_zh} / {$vo.channel_zh} / {$vo.category_id_zh} | 
										{if $vo['is_distribution'] == 1}
								<span style="color: #e84e40;">{$userlist[$vo['uid']]??$vo['uid']}</span>
								{else/}
								{$userlist[$vo['uid']]??$vo['uid']}
								{/if} </td> -->
		<!-- <td>{$vo.tag_ids_zh}</td> -->

		{if checkAuthRule('edit')}
		<td>
			{if checkAuthRule('del')}<a href="{:url('del_my',array('id'=>$vo['id']))}" class="ajax-get confirm"><i
					class="fa fa-times"></i> 删除</a>{/if}
			<a href="JavaScript:;" onclick="editreferral(this)" data-json='{:json_encode($vo)}'><i
					class="fa fa-edit"></i> 查看</a>
		</td>
		{/if}
		</tr>
		{/eq}
		{/volist}
		</tbody>
		</table>
	</div>
</div>
</div>
{/if}


{if $mb == 3}
<div class="tiktok big">
	<div class="row toolTip">
		{volist name="list" id="vo"}
		<div id="content_{$vo.id}" style="display: none;">
			{:str_replace("####","<br />",htmlspecialchars_decode($vo['content_zh2']))}</div>
		<div class="col-md-3">
			<div class="panel panel-default">
				<div class="big-panel-head">
					<div style="display: flex;width: 100%;justify-content: space-between;color: #b1b0b0;">
						<span
							style="white-space: nowrap;text-overflow: ellipsis;overflow: hidden;word-break: break-all;width: 180px;"><input
								class="ids row-selected" type="checkbox" name="id[]" value="{$vo['id']}"
								style="margin:0">&nbsp;{$vo.title}</span>
						<span>{$vo.show_time}</span>
					</div>
				</div>
				<div class="panel-body" style="padding: 0;">
					<span class="headContent" style="padding: 0 30px;" data-id="{$vo['id']}"
						data-title="{$vo['title']|default="
						无"}">{:str_replace("####","<br />",htmlspecialchars_decode($vo['content_zh2']))}</span>
					<!-- <div class="num">{$vo['id']}</div> -->
				</div>
				<div class="panel-footer" style="flex-direction: column;">
					<div style="justify-content: space-between;width: 100%;">
						<div style="display: flex;align-items: center;">
							{$vo.num}&nbsp;
							{if $vo['is_distribution'] == 1}
							<span style="color: #e84e40;">{$userlist[$vo['uid']]??$vo['uid']}</span>
							{else/}
							{$userlist[$vo['uid']]??$vo['uid']}
							{/if}
						</div>
						<div class="btnGurp">
							<div onclick="copyContent(`{:str_replace('####','<br/>',htmlspecialchars_decode($vo['content_zh2']))}`,{$vo.id} )" class="copy">
							<span class="iconfont icon-copy"></span>
							复制
						</div>

						<div>
							<a style="color:#000"
								onclick="downTxt('{:url('down_txt')}?platform_ids={$platform_id}&type={$type}&id[]={$vo.id}')">TXT</a>
						</div>


						<div onclick="editreferral(this)" data-json='{:json_encode($vo)}'>
							修改
						</div>
						{if checkAuthRule('edit')}
						<div class="edit">
							<a style="color:#000" href="{:url('wenan-my_1_1')}?&platform_ids=3&my_id={$vo.id}">编辑</a>
						</div>
						{/if}
						<div style="margin:0 8px" onclick="change_status({$vo.id})">
							<!-- <span style="font-size: 19px;" class="iconfont icon-duigou"></span> -->
							{if $vo['status'] == 0}<span style="font-size: 19px;"
								class="iconfont icon-duigou"></span>{else/}<span style="font-size: 19px;"
								class="iconfont icon-duigou-copy"></span>{/if}
						</div>

						<div onclick="upload(this, {$vo['id']})" id="upload_id_{$vo['id']}"
							data-json='{:json_encode($vo)}'>
							{if $vo['is_upload']}<i class="iconfont icon-shangchuan1-copy"></i>{else/}<i
								class="iconfont icon-shangchuan1"></i>{/if}
						</div>

					</div>
				</div>
			</div>
		</div>
		<div class="mask">
			<div class="content">{:str_replace("####","<br />",htmlspecialchars_decode($vo['content_zh2']))}</div>
		</div>
	</div>
	{/volist}
</div>
</div>
{/if}
{$page}
</div>
</div>

<div class="modal fade" id="create-referral-link-modal">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
						aria-hidden="true">×</span></button>
				<span style="font-size: 20px;"><span id="referralname">添加</span></span>
			</div>
			<div class="modal-body">
				<div data-bind="visible: loading" class="loading-panel" style="display: none;">
					<i class="fa fa-spin fa-spinner"></i>
				</div>
				<form class="form-horizontal modelform">
					{include file="material/_from" /}
				</form>
			</div>
			<div class="modal-footer">
				<button type="button" id="createreferral" class="btn btn-primary ">提交</button>
			</div>
		</div>
	</div>
</div>

{include file="adsmaterialbook/_from" /}
{/block}
{block name="script"}
<script type="text/javascript" src="__PUBLIC__/plugs/layer/layer.js"></script>
<script type="text/javascript">
	function follow(ee, id) {
		var url = "{:url('addFollow')}";
		$.ajax({
			type: "POST",
			url: url,
			data: { id: id },
			dataType: "json",
			success: function (data) {
				if (data.code == 1) {
					layer.msg(data.msg);
					setTimeout(function () {
						window.location.href = "{:url('my_1_1')}?platform_ids=3";
					}, 1000);
				} else {
					updateAlert("失败，" + data.msg, 'danger');
				}
			},
			error: function (e) {
				console.log(e.status);
				console.log(e.responseText);
			}
		})
	}
</script>
<script type="text/javascript" src="__PUBLIC__/plugs/webuploader/webuploader.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/plugs/webuploader/webuploader.custom.js"></script>
<script type="text/javascript">

	$(function () {
		$('#createUrl').on('click', function () {
			var $modal = $('#create-referral-link-modal');
			$modal.on('shown.bs.modal', function () {
				$("#picker_ebook").html('<div>上传文案</div>')
				$("#picker_ebook").SentUploader({
					server: "{:url('Upload/Uploadtxt')}",
					fileNumLimit: 1,
					uploadEvents: {
						uploadComplete: function (file) { }
					},
					listName: 'fileList_ebook',
					hiddenName: 'field_ebook',
					hiddenValType: 2,
					fileSingleSizeLimit: 50 * 1024 * 1024,
					closeX: true
				},
					{
						fileType: 'service',
						filename: 'images',
					});
			});
			$modal.modal({backdrop: 'static', keyboard: false});
		});
		$("#createreferral").on('click', function () {
			var data = data2 = $('.modelform').serializeJson();
			console.log(data);
			if (data['content'].length == 0 && $("#field_ebook").val() == '') {
				updateAlert("不能为空", 'danger');
				return false;
			}
			var url = "{:url('add_my')}";
			$.ajax({
				type: "POST",
				url: url,
				data: data,
				dataType: "json",
				success: function (data) {
					if (data.code == 1) {
						updateAlert(data.msg, 'success');
						if (data2['id'] == $('body').attr("upload_id")) {
							upload($("#upload_id_" + data2['id']), data2['id']);
						}
						setTimeout(function () {
							window.location.reload();
						}, 100);
					} else {
						updateAlert("添加，" + data.msg, 'danger');
					}
				},
				error: function (e) {
					console.log(e.status);
					console.log(e.responseText);
				}
			})
		});
	});

	$('.panel-body .show').click(function () {
		$(this).parent().parent().siblings().show()
	})
	$('.mask i').click(function () {
		$(this).parent().hide()
	})


</script>
{include file="material/pub_footer"}
{/block}